<?php

use think\Facade\Route;
use think\Facade\Env;

Route::domain(Env::get('app.api_url'), function () {
    header("Access-Control-Allow-Origin: *");
    header('Access-Control-Allow-Methods: POST, PUT, GET, OPTIONS, DELETE, HEAD, PATCH');
    header("Access-Control-Allow-Headers: token,tokens,language, Origin, X-Requested-With, Content-Type, Accept");
    Route::miss(function () {
        $result = [
            'code' => 1,
            'msg'  => '接口不存在',
            'time' => time(),
            'data' => [],
        ];
        return json($result);
        exit();
    });
    Route::group('User', function () {
        Route::post('login', '/login'); //登录
        Route::rule('dockorder', '/dockorder'); //提交交接单
        Route::get('info', '/info'); //个人信息
        Route::get('getgoods', '/getgoods'); //物料信息
        Route::get('getothers', '/getothers'); //其他 协议、隐私等
        Route::get('getconfig', '/getconfig'); //项目列表等
        Route::post('delordergoods', '/delordergoods'); //登录
        Route::get('orderlist', '/orderlist'); //项目列表等
        Route::get('myorderlist', '/myorderlist'); //项目列表等
        Route::post('cacelorder', '/cacelorder'); //登录
        Route::post('editfhrs', '/editfhrs'); //登录
        Route::post('fahuopost', '/fahuopost'); //登录
        Route::post('confirmorder', '/confirmorder'); //登录
        Route::get('getdatas', '/getdatas'); //项目列表等
        Route::rule('getopenid', '/getopenid'); //项目列表等
        Route::get('addressjson', '/addressjson'); //项目列表等
        Route::get('getordergoodlist', '/getordergoodlist'); //项目列表等
    })->prefix('User');
})->bind('api')->prefix('api');
